home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
webtp55.zip
/
WEAVE.CHG
< prev
next >
Wrap
Text File
|
1989-12-01
|
26KB
|
793 lines
% This is WEAVE.CHG for TURBO Pascal 5.5
% (c) 1989 by Peter Sawatzki
%
% Change History:
%
% Initials: PS = Peter Sawatzki, FE617@DHAFEU11
% =========
%
% rel. date Author description
% ==== ==== ====== ===========
% v0.1 5-Mar-88 PS initial TP3 release
% v0.2 29-Jul-89 PS @i option: (nested) include files
%
%
% Tangle/Compile Instructions:
% ============================
% TANGLE WEAVE /d /m /c
% TPC /$A+,O-,E-,N-,B-,I-,V-,S-,D- /$M$5000,0,$2000 WEAVE
%
%
────────────────────────────────────────────────────────────────
@x l.72 m.1
@d banner=='This is WEAVE, Version 4'
@y
@d banner=='This is WEAVE, Version 4/TP55 0.2'
@z
────────────────────────────────────────────────────────────────
@x l.82 m.2
@d end_of_WEAVE = 9999 {go here to wrap it up}
@p @t\4@>@<Compiler directives@>@/
program WEAVE(@!web_file,@!change_file,@!tex_file);
label end_of_WEAVE; {go here to finish}
const @<Constants in the outer block@>@/
type @<Types in the outer block@>@/
var @<Globals in the outer block@>@/
@y
@p program WEAVE;
const @<Constants in the outer block@>@/
type @<Types in the outer block@>@/
const @<Typed constants in the outer block@>@/
var @<Globals in the outer block@>@/
@<Inline procedures and functions@>@/
@<All purpose procedures and functions@>@/
@z
────────────────────────────────────────────────────────────────
@x l.101 m.3
@d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging}
@d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging}
@y
@d ifdef(#)==@={$ifdef @>#@=}@>
@d endif==@={$endif}@>
@d debug==ifdef(deb)
@d gubed==endif
@d Asm(#)==inline(@[#@])
@z
────────────────────────────────────────────────────────────────
@x l.106 m.3
@d stat==@{ {change this to `$\\{stat}\equiv\null$'
when gathering usage statistics}
@d tats==@t@>@} {change this to `$\\{tats}\equiv\null$'
when gathering usage statistics}
@y
@d stat==ifdef(sta)
@d tats==endif
@z
────────────────────────────────────────────────────────────────
@x l.121 m.4
@<Compiler directives@>=
@{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
@!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
@y
@<Inline proc...@>=
function mavail: word;
Asm(mov ah,$48/ {allocate memory}
mov bx,$FFFF/ {determine free memory}
int $21/
mov ax,bx); {return size of largest available block}
function malloc (no: word): word;
Asm(mov ah,$48/ {allocate memory}
pop bx/ {no of bytes}
int $21/
jnc ok/ {no error}
xor ax,ax/ {clear ax in case of error}
ok: );
procedure mfree (segm: word);
Asm(mov ah,$49/ {free memory}
pop es/ {segment to free}
int $21);
@z
────────────────────────────────────────────────────────────────
@x l.146 m.6
@d incr(#) == #:=#+1 {increase a variable by unity}
@d decr(#) == #:=#-1 {decrease a variable by unity}
@y
@d incr(#) == Inc(#) {increase a variable by unity}
@d decr(#) == Dec(#) {decrease a variable by unity}
@d integer == LongInt
@d void == begin end
@z
────────────────────────────────────────────────────────────────
@x l.172 m.7
@d othercases == others: {default for cases not listed explicitly}
@y
@d othercases == else {default for cases not listed explicitly}
@z
────────────────────────────────────────────────────────────────
@x l.181 m.8
@!max_bytes=45000; {|1/ww| times the number of bytes in identifiers,
index entries, and module names; must be less than 65536}
@!max_names=5000; {number of identifiers, index entries, and module names;
must be less than 10240}
@!max_modules=2000;{greater than the total number of modules}
@!hash_size=353; {should be prime}
@!buf_size=100; {maximum length of input line}
@!longest_name=400; {module names shouldn't be longer than this}
@!long_buf_size=500; {|buf_size+longest_name|}
@!line_length=80; {lines of \TeX\ output have at most this many characters,
should be less than 256}
@!max_refs=30000; {number of cross references; must be less than 65536}
@!max_toks=30000; {number of symbols in \PASCAL\ texts being parsed;
must be less than 65536}
@!max_texts=2000; {number of phrases in \PASCAL\ texts being parsed;
must be less than 10240}
@!max_scraps=1000; {number of tokens in \PASCAL\ texts being parsed}
@!stack_size=200; {number of simultaneous output levels}
@y
@!max_bytes=6400; {|1/ww| times the number of bytes in identifiers,
index entries, and module names; must be less than 65536}
@!max_names=5000; {number of identifiers, index entries, and module names;
must be less than 10240}
@!max_modules=2000;{greater than the total number of modules}
@!hash_size=353; {should be prime}
@!buf_size=100; {maximum length of input line}
@!longest_name=400; {module names shouldn't be longer than this}
@!long_buf_size=500; {|buf_size+longest_name|}
@!line_length=80; {lines of \TeX\ output have at most this many characters,
should be less than 256}
@!max_refs=32000; {number of cross references; must be less than 65536}
@!max_toks=32000; {number of symbols in \PASCAL\ texts being parsed;
must be less than 65536}
@!max_texts=3000; {number of phrases in \PASCAL\ texts being parsed;
must be less than 10240}
@!max_scraps=3000; {number of tokens in \PASCAL\ texts being parsed}
@!stack_size=300; {number of simultaneous output levels}
@z
────────────────────────────────────────────────────────────────
@x l.307 m.12
@!text_file=packed file of text_char;
@y
@!text_file=Text;
@z
────────────────────────────────────────────────────────────────
@x l.309 m.13
@ The \.{WEAVE} and \.{TANGLE} processors convert between ASCII code and
the user's external character set by means of arrays |xord| and |xchr|
that are analogous to \PASCAL's |ord| and |chr| functions.
@<Globals...@>=
@!xord: array [text_char] of ASCII_code;
{specifies conversion of input characters}
@!xchr: array [ASCII_code] of text_char;
{specifies conversion of output characters}
@ If we assume that every system using \.{WEB} is able to read and write the
visible characters of standard ASCII (although not necessarily using the
ASCII codes to represent them), the following assignment statements initialize
most of the |xchr| array properly, without needing any system-dependent
changes. For example, the statement \.{xchr[@@\'101]:=\'A\'} that appears
in the present \.{WEB} file might be encoded in, say, {\mc EBCDIC} code
on the external medium on which it resides, but \.{TANGLE} will convert from
this external code to ASCII and back again. Therefore the assignment
statement \.{XCHR[65]:=\'A\'} will appear in the corresponding \PASCAL\ file,
and \PASCAL\ will compile this statement so that |xchr[65]| receives the
character \.A in the external (|char|) code. Note that it would be quite
incorrect to say \.{xchr[@@\'101]:="A"}, because |"A"| is a constant of
type |integer|, not |char|, and because we have $|"A"|=65$ regardless of
the external character set.
@<Set init...@>=
xchr[@'40]:=' ';
xchr[@'41]:='!';
xchr[@'42]:='"';
xchr[@'43]:='#';
xchr[@'44]:='$';
xchr[@'45]:='%';
xchr[@'46]:='&';
xchr[@'47]:='''';@/
xchr[@'50]:='(';
xchr[@'51]:=')';
xchr[@'52]:='*';
xchr[@'53]:='+';
xchr[@'54]:=',';
xchr[@'55]:='-';
xchr[@'56]:='.';
xchr[@'57]:='/';@/
xchr[@'60]:='0';
xchr[@'61]:='1';
xchr[@'62]:='2';
xchr[@'63]:='3';
xchr[@'64]:='4';
xchr[@'65]:='5';
xchr[@'66]:='6';
xchr[@'67]:='7';@/
xchr[@'70]:='8';
xchr[@'71]:='9';
xchr[@'72]:=':';
xchr[@'73]:=';';
xchr[@'74]:='<';
xchr[@'75]:='=';
xchr[@'76]:='>';
xchr[@'77]:='?';@/
xchr[@'100]:='@@';
xchr[@'101]:='A';
xchr[@'102]:='B';
xchr[@'103]:='C';
xchr[@'104]:='D';
xchr[@'105]:='E';
xchr[@'106]:='F';
xchr[@'107]:='G';@/
xchr[@'110]:='H';
xchr[@'111]:='I';
xchr[@'112]:='J';
xchr[@'113]:='K';
xchr[@'114]:='L';
xchr[@'115]:='M';
xchr[@'116]:='N';
xchr[@'117]:='O';@/
xchr[@'120]:='P';
xchr[@'121]:='Q';
xchr[@'122]:='R';
xchr[@'123]:='S';
xchr[@'124]:='T';
xchr[@'125]:='U';
xchr[@'126]:='V';
xchr[@'127]:='W';@/
xchr[@'130]:='X';
xchr[@'131]:='Y';
xchr[@'1